// ==UserScript==
// @name WME-Addons
// @description This script extend WME capabilities with cool features.
// @namespace wme-addons
// @version        0.46
// @updateURL      http://elite-tools.googlecode.com/svn/branches/injectit.user.js
// @icon       	   http://elite-tools.googlecode.com/svn/branches/images/swiss_knife.png
// @resource       images/swiss_knife.png http://elite-tools.googlecode.com/svn/branches/images/swiss_knife.png
// @resource       images/10arrowup.gif http://elite-tools.googlecode.com/svn/branches/images/10arrowup.gif
// @resource       images/10arrowdown.gif http://elite-tools.googlecode.com/svn/branches/images/10arrowdown.gif
// @resource       JavascriptInheritance.js http://elite-tools.googlecode.com/svn/branches/JavascriptInheritance.js
// @resource       sortable.js http://elite-tools.googlecode.com/svn/branches/sortable.js
// @resource       WME-Addons.js http://elite-tools.googlecode.com/svn/branches/WME-Addons.js
// @grant          GM_getResourceURL
// @grant          GM_getResourceText
// @match          https://world.waze.com/editor/*
// @match          https://www.waze.com/editor/*
// @match          https://world.waze.com/map-editor/*
// @match          https://www.waze.com/map-editor/*
// @match          https://editor-beta.waze.com/*
// @include        https://*.waze.com/editor/*
// @include        https://*.waze.com/map-editor/*
// @include        https://*.waze.com/beta_editor/*
// @include        https://descartesw.waze.com/beta/*
// @include        https://editor-beta.waze.com/*
// ==/UserScript==

/*
 *  Copyright (c) 2012 - 2013 Gilles Dupeyrou
 * Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license.
 */

var testGM_TM;
var getURL;
var isCRX = false;

testGM_TM = function() {
	try {
		return (typeof GM_getResourceURL === "function");
	}
	catch (err) {
		return false;
	}
};

getURL = function(path) {
	if (isCRX || (!testGM_TM && (window.navigator.vendor.match(/Google/)))) {
		return chrome.extension.getURL(path);
	} else {
		return GM_getResourceURL(path);
	}
};

var SortScript = document.createElement('script');
//SortScript.src = getURL("sortable.js");
SortScript.type = 'text/javascript';
SortScript.text = GM_getResourceText("sortable.js");
SortScript.async = false;
SortScript.onload = function() {
};

var ClassScript = document.createElement('script');
//ClassScript.src = getURL("JavascriptInheritance.js");
ClassScript.type = 'text/javascript';
ClassScript.text = GM_getResourceText("JavascriptInheritance.js");
ClassScript.async = false;
ClassScript.defer = false;
ClassScript.onload = function() {
};

var s = document.createElement('script');
//s.src = getURL("WME-Addons.js");
s.type = 'text/javascript';
s.text = GM_getResourceText("WME-Addons.js");
s.async = false;
s.onload = function() {
};

var img = document.createElement('img');
img.src = getURL('images/swiss_knife.png');
img.name = "WME_Icon";
img.async = false;
img.onload = function() {
};

var imgup = document.createElement('img');
imgup.src = getURL('images/10arrowup.gif');
imgup.name = "arrow_up";
imgup.async = false;
imgup.onload = function() {
};

var imgdown = document.createElement('img');
imgdown.src = getURL('images/10arrowdown.gif');
imgdown.name = "arrow_down";
imgdown.async = false;
imgdown.onload = function() {
};

document.head.appendChild(ClassScript);
document.head.appendChild(SortScript);
document.head.appendChild(img);
document.head.appendChild(imgup);
document.head.appendChild(imgdown);
document.head.appendChild(s);
